package com.huaqin.punan;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class ReadXMLSax {
	public static final String TAG = "ReadXMLSax";
	public static boolean debug = true;
	public static final String FILE_PATH = MainActivity.FILE_PATH;
	public static final String FILE_NAME = MainActivity.FILE_NAME;

	static String[] ReadXMLFiles(){
		String[] salesinfo = new String[]{"0","0","0","0","0","0"};

		
		try {
			
			File file = new File(FILE_PATH+FILE_NAME);
			InputStream is = new FileInputStream(file);
			
			SAXParserFactory mSAXParserFactory = SAXParserFactory.newInstance();
			SAXParser mSAXParser = mSAXParserFactory.newSAXParser();
			
			mSAXParser.setProperty("http://xml.org/sax/features/namespaces", true);
			XMLContentHandler mXMLContentHandler = new XMLContentHandler();
			
			mSAXParser.parse(is, mXMLContentHandler);
			
			
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
		
		return salesinfo;
	}
} 

class XMLContentHandler extends DefaultHandler{
	String[] salesinfo = new String[]{"0","0","0","0","0","0"};
}
